package com.rectcircle.scalatrateset.controller

import org.scalatra.metrics.{HealthChecksSupport, MetricsSupport}

/**
  * @author Rectcircle
  *         createTime 2017/1/15
  */
class TestController extends ScalatratestStack with MetricsSupport  with HealthChecksSupport{
	get("/") {
		timer("timer") {
			// Code that's timed by a timer named "timer"
		}
		
		// Increments a counter called "counter"
		counter("counter") += 1
		
		// Increments a histogram called "histogram"
		histogram("histogram") += 1
		
		// Sets a gauge called "gauge"
		gauge("gauge") {
			"gauge"
		}
		
		// Sets a meter named "meter"
		meter("meter").mark(1)
	}
	
	get("/health") {
		healthCheck("basic") {
			true
		}
		
		healthCheck("withMessage", unhealthyMessage = "DEADBEEF") {
			true
		}
	}
}
